home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / blended-logo.scm.z / blended-logo.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  4.3 KB  |  91 lines

  1. ;  BLENDED-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a blended background using current gimp fg
  3. ;   and bg colors.  The finished blend has a drop shadow underneath that blends
  4. ;   to the specified bg-color
  5. ;  if the blend colors are specified as high intensity, the sharp option
  6. ;   should be enabled or the logo will come out blurry
  7.  
  8. (define (scale size percent) (* size percent))
  9.  
  10. (define (script-fu-blended-logo blend-mode text size font bg-color text-color blend-fg blend-bg)
  11.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  12.      (b-size (scale size 0.1))
  13.      (b-size-2 (scale size 0.05))
  14.      (f-size (scale size 0.075))
  15.      (ds-size (scale size 0.05))
  16.      (ts-size (- b-size-2 3))
  17.      (text-layer (car (gimp-text img -1 0 0 text b-size TRUE size PIXELS "*" font "*" "*" "*" "*")))
  18.      (width (car (gimp-drawable-width text-layer)))
  19.      (height (car (gimp-drawable-height text-layer)))
  20.      (blend-layer (car (gimp-layer-new img width height RGBA_IMAGE "Blend" 100 NORMAL)))
  21.      (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 NORMAL)))
  22.      (text-shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Text Shadow" 100 MULTIPLY)))
  23.      (tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer BLACK-MASK)))
  24.      (drop-shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Drop Shadow" 100 MULTIPLY)))
  25.      (dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer BLACK-MASK)))
  26.      (old-fg (car (gimp-palette-get-foreground)))
  27.      (old-bg (car (gimp-palette-get-background))))
  28.     (gimp-image-disable-undo img)
  29.     (gimp-image-resize img width height 0 0)
  30.     (gimp-image-add-layer img shadow-layer 1)
  31.     (gimp-image-add-layer img blend-layer 1)
  32.     (gimp-image-add-layer img drop-shadow-layer 1)
  33.     (gimp-image-add-layer img text-shadow-layer 0)
  34.     (gimp-selection-none img)
  35.     (gimp-edit-clear img text-shadow-layer)
  36.     (gimp-edit-clear img drop-shadow-layer)
  37.     (gimp-palette-set-background text-color)
  38.     (gimp-layer-set-preserve-trans text-layer TRUE)
  39.     (gimp-edit-fill img text-layer)
  40.     (gimp-palette-set-background bg-color)
  41.     (gimp-drawable-fill shadow-layer BG-IMAGE-FILL)
  42.     (gimp-rect-select img b-size-2 b-size-2 (- width b-size) (- height b-size) REPLACE TRUE b-size-2)
  43.     (gimp-palette-set-background '(0 0 0))
  44.     (gimp-edit-fill img shadow-layer)
  45.     (gimp-selection-layer-alpha img text-layer)
  46.     (gimp-image-add-layer-mask img text-shadow-layer tsl-layer-mask)
  47.     (gimp-palette-set-background '(255 255 255))
  48.     (gimp-edit-fill img tsl-layer-mask)
  49.     (gimp-selection-feather img f-size)
  50.     (gimp-palette-set-background '(63 63 63))
  51.     (gimp-edit-fill img drop-shadow-layer)
  52.     (gimp-palette-set-background '(0 0 0))
  53.     (gimp-edit-fill img text-shadow-layer)
  54.     (gimp-palette-set-foreground '(255 255 255))
  55.     (gimp-blend img text-shadow-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 0 0 1 1)
  56.     (gimp-selection-none img)
  57.     (gimp-palette-set-foreground blend-fg)
  58.     (gimp-palette-set-background blend-bg)
  59.     (gimp-blend img blend-layer blend-mode NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 0 width 0)
  60.     (gimp-layer-translate text-layer (- b-size-2) (- b-size-2))
  61.     (gimp-layer-translate blend-layer (- b-size) (- b-size))
  62.     (gimp-layer-translate text-shadow-layer (- ts-size) (- ts-size))
  63.     (gimp-layer-translate drop-shadow-layer ds-size ds-size)
  64.     (gimp-selection-layer-alpha img blend-layer)
  65.     (gimp-image-add-layer-mask img drop-shadow-layer dsl-layer-mask)
  66.     (gimp-palette-set-background '(255 255 255))
  67.     (gimp-edit-fill img dsl-layer-mask)
  68.     (gimp-image-remove-layer-mask img drop-shadow-layer APPLY)
  69.     (gimp-selection-none img)
  70.     (gimp-layer-set-name text-layer text)
  71.     (gimp-palette-set-foreground old-fg)
  72.     (gimp-palette-set-background old-bg)
  73.     (gimp-image-enable-undo img)
  74.     (gimp-display-new img)))
  75.  
  76. (script-fu-register "script-fu-blended-logo"
  77.             "<Toolbox>/Xtns/Script-Fu/Logos/Blended"
  78.             "Creates logos with blended backgrounds, highlights, and shadows"
  79.             "Spencer Kimball"
  80.             "Spencer Kimball"
  81.             "1996"
  82.             ""
  83.             SF-VALUE "Blend Mode" "FG-BG-RGB"
  84.             SF-VALUE "Text String" "\"The GIMP\""
  85.             SF-VALUE "Font Size (in pixels)" "150"
  86.             SF-VALUE "Font" "\"Crillee\""
  87.             SF-COLOR "Background Color" '(255 255 255)
  88.             SF-COLOR "Text Color" '(124 174 255)
  89.             SF-COLOR "Starting Blend" '(22 9 129)
  90.             SF-COLOR "Ending Blend" '(129 9 82))
  91.